package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.CustomerUserEntity;
import com.xbongbong.saas.domain.entity.PaymentSheetUserEntity;
import com.xbongbong.saas.domain.entity.UserTeamEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author 徐俊杰
 * @date 2020/2/13 10:29
 * @since v1.0
 */
@Repository
@Mapper
public interface PaymentSheetUserDao {
    
    Long insert(PaymentSheetUserEntity entity);
    
    void insertBatch(@Param("list")List<PaymentSheetUserEntity> paymentUserEntityList);
    
    List<PaymentSheetUserEntity> findEntitys(@Param("param") Map<String,Object> param);
    
    Integer update(PaymentSheetUserEntity paymentUserEntity);
    
    List<UserTeamEntity> findBaseEntitys(@Param("param") Map<String,Object> map);
    
    void batchDeleteById(@Param("corpid") String corpid, @Param("idIn") List<Long> removeIdList);
    
    /**
     * 批量修改
     *
     * @param corpid
     * @param dataIdIn
     * @param isMain
     * @param del
     */
    void batchUpdateByIdIn(@Param("corpid")String corpid, @Param("idIn")List<Long> dataIdIn, @Param("isMain")Integer isMain, @Param("del")Integer del);
    
    void deleteBatch(@Param("list") List<Long> idList, @Param("corpid") String corpid);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    void deleteByPaymentSheetIds(@Param("dataIdIn") List<Long> dataIds, @Param("corpid") String corpid);

    /**
     * 批量修改团队里面成员为协同人以及协同人可编辑权限
     *
     * @param corpid
     * @param dataIdIn
     * @param isMain
     * @param formPermission
     */
    void batchUpdateCoAndPerByUserIdIn(@Param("corpid")String corpid, @Param("dataIdIn")List<Long> dataIdIn, @Param("isMain")Integer isMain, @Param("formPermission")Integer formPermission);


    void disbandedTeamByCustomerId(@Param("corpid") String corpid, @Param("dataIdIn") List<Long> customerIdList);

    /**
     * 根据id查询数据
     *
     * @param key    主键
     * @param corpid 公司ID
     * @return 是否成功
     * @author feng.zheng
     * @date 2019/1/23 20:00
     * @since v1.0
     **/
    PaymentSheetUserEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 批量更新回款单团队的删除标识，这边一开始是为了工作流撤回使用 删除标识是6；后面如果其它要使用注意一下
     *
     * @param list
     * @param corpid
     * @param del
     */
    void deleteBatchByIdList(@Param("list") List<Long> list, @Param("corpid") String corpid, @Param("del")Integer del);
}
